home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Games Extra 1996 June
/
Amiga Games Extra 1996 #6.iso
/
userbox
/
publicdomain
/
iffmaster
/
rexx
/
removeanno.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-03-23
|
3KB
|
102 lines
/*
** $VER: RemoveANNO.rexx (23 Mar 1996) **
**
** © 1996 Kay Drangmeister
**
**
** PROGRAMNAME:
** RemoveANNO
**
** FUNCTION:
** Scans directory and removes ANNO chunk from every file it finds.
**
** WARNING: This script OVERWRITES your files with the shortened ones
** after having asked the user to do so.
** Use at your own risk!
**
** $HISTORY:
**
** 23 Mar 1996 : 1.0 : initial release
*/
PortName = 'IFFMASTER.1' /* portname, usually IFFMASTER.1 */
LF = '0a'x /* linefeed */
iffmpath = 'IFFMaster' /* change this to your path */
PARSE ARG LoadPath .
IF (LoadPath=="") THEN DO
SAY "USAGE: RemoveANNO.rexx <directory>" LF " WARNING: Overwrites files (but asks before doing it)"
EXIT 0
END
ADDRESS VALUE PortName
IFFMACTIVE=1
IF ~SHOW('Ports',PortName) THEN DO
IFFMACTIVE=0 /* indicate that we did start IFFMaster through the script */
ADDRESS 'COMMAND' 'Run >NIL: 'iffmpath
ADDRESS 'COMMAND' 'WaitForPort '||PortName
IF ~SHOW('Ports',PortName) THEN EXIT 10
END
IF ~SHOW('l','rexxsupport.library') THEN DO
CALL addlib('rexxsupport.library',0,-30)
END
OPTIONS RESULTS
'limithex bytes 16' /* we ignore hex dumps */
dd = showdir(LoadPath,"FILE") /* build list of files */
numfiles = words(dd)
j=0
DO i=1 to numfiles
fn = WORD(dd,i)
IF (upper(right(fn,5))~=".INFO") THEN DO
j=j+1
FileName.j=fn
/* say "found " || LoadPath || FileName.j */
END
END
numfiles=j
'showformat 4' /* show quick chunk contents in chunk list */
DO i=1 to numfiles
'load 'LoadPath || FileName.i
changed=0
'entries'; nument=RESULT
count=0
DO j=0 FOR nument;
'cursorpos 'j
'chunkid'; ID=RESULT
IF ID='ANNO' THEN DO
'chunktext'
anno=RESULT
ADDRESS COMMAND 'RequestChoice >env:removeannorexxvar "RemoveANNO request" "In file *"' || FileName.i || '*",*Ndelete chunk with contents*N*"' || anno || '*"?" "Yes" "NO"'
OPEN("RAVar","env:removeannorexxvar","R")
var=READLN("RAVar")
CLOSE("RAVar")
DELETE("env:removeannorexxvar")
IF (var=1) THEN DO
'editable on'
'overwrite on'
'delete'
changed=1
END
LEAVE
END
END
IF changed=1 THEN 'save'
END
IF IFFMACTIVE=0 THEN DO
ADDRESS Value portname
'quit' /* we started IFFMaster ourselves, so close it */
END
EXIT(0)